package com.example.task.scheduler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/21 10:08
 */
@Component
@Slf4j
public class Scheduler1 {
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

    @Scheduled(fixedRate = 6000)
    public void reportCurrentTime() {
        log.info("现在时间：{}" , dateFormat.format(new Date()));
    }
}
